
package com.hexinfo.dmpro.sparing.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hexinfo.dmpro.common.utils.CommonConstants;
import com.hexinfo.dmpro.common.utils.StringUtils;
import com.hexinfo.dmpro.sparing.model.UatSyncLogsTask;
import com.hexinfo.dmpro.sparing.dao.UatSyncLogsTaskMapper;
import com.hexinfo.dmpro.sparing.service.UatSyncLogsTaskService;
import org.springframework.stereotype.Service;

/**
 * UAT同步日志任务表
 *
 * @author yemw
 * @date 2023-11-21 16:03:08
 */
@Service
public class UatSyncLogsTaskServiceImpl extends ServiceImpl<UatSyncLogsTaskMapper, UatSyncLogsTask> implements UatSyncLogsTaskService {

    @Override
    public Page queryList(Page page, UatSyncLogsTask uatSyncLogsTask) {
        LambdaQueryWrapper<UatSyncLogsTask> wrapper = Wrappers.lambdaQuery();
        wrapper .like(StrUtil.isNotBlank(uatSyncLogsTask.getLibraryTableName()),UatSyncLogsTask::getLibraryTableName,StringUtils.toLowerCase(uatSyncLogsTask.getLibraryTableName()))
                .like(StrUtil.isNotBlank(uatSyncLogsTask.getTaskName()),UatSyncLogsTask::getTaskName,StringUtils.toUpperCase(uatSyncLogsTask.getTaskName()))
                .like(StrUtil.isNotBlank(uatSyncLogsTask.getSourceName()),UatSyncLogsTask::getSourceName, StringUtils.toUpperCase(uatSyncLogsTask.getSourceName()))
                .eq(StrUtil.isNotBlank(uatSyncLogsTask.getTaskState()),UatSyncLogsTask::getTaskState,uatSyncLogsTask.getTaskState())
                .eq(UatSyncLogsTask::getDel,CommonConstants.STATUS_NORMAL).orderByDesc(UatSyncLogsTask::getCreateTime);
        Page returnPage = this.baseMapper.selectPage(page, wrapper);
        return returnPage;
    }
}
